package com.datastructures.recursion;

/**
 * 递归
 * @author MaoLin Wang
 * @date 2019/10/2217:44
 */
public class RecursionDemo {
    public static void main(String[] args) {
        int factorial = factorial(5);
        System.out.println(factorial);
    }

    //阶乘问题
    public static int factorial(int n){
        if(n==1){
            return 1;
        }else {
            return factorial(n-1)*n;
        }
    }
}
